import nodemailer from 'nodemailer';
import { OAuth2Client, TokenPayload } from 'google-auth-library';
import { publicKeysString } from '../assets/google-publickeys';
import jwt from 'jsonwebtoken';

class EmailService {
    myEmail = '1791083815@qq.com';

    transporter = nodemailer.createTransport({
        service: 'qq',
        secure: true,
        auth: {
            user: this.myEmail,
            pass: "kwfvaixvvhydcefi",
        },
    });

    async sendCaptcha(options: {to: string, captcha: string}) {
        const {to, captcha} = options;
        return this.transporter.sendMail({
            from: `"Screen Shot Api Captcha" <${this.myEmail}>`,
            to,
            subject: 'Captcha',
            text: 'Please enter the following captcha: ' + captcha,
            html: `<b>Captcha: ${captcha}</b>`
        });
    }
}

export default new EmailService();
